<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><spring:message code="dashboard.title" /></title>
<tags:script source="/js/jquery/jquery-1.6.2.js" />
<tags:script source="/js/jquery/ui/jquery-ui-1.8.16.min.js" />
<tags:script source="/js/jquery/ui/jquery.ui.draggable.min.js" />
<tags:script source="/js/jquery/ui/jquery.ui.core.min.js" />
<tags:script source="/js/jquery/ui/jquery.ui.position.min.js" />
<tags:script source="/js/jquery/ui/jquery.ui.widget.min.js" />
<tags:script source="/js/jquery/ui/jquery.ui.autocomplete.min.js" />
<tags:script source="/js/jquery/jquery.form.js" />
<tags:script source="/js/jquery/jquery.validate.js" />
<tags:script source="/js/jquery/jquery.qtip.js" />
<tags:script source="/js/jquery/jquery.tablesorter.js" />
<tags:script source="/js/jquery/jquery.dateFormat-1.0.js" />
<tags:script source="/js/main.js" />

<tags:style source="/css/jquery/ui/jquery-ui-1.8.16.css" />
<tags:style source="/css/jquery/ui/jquery.ui.autocomplete.css" />
<tags:style source="/css/jquery/ui/jquery.ui.base.css" />
<tags:style source="/css/jquery/ui/jquery.ui.core.css" />
<tags:style source="/css/jquery/ui/jquery.ui.theme.css" />
<tags:style source="/css/jquery/jquery.qtip.css" />
<link href="<c:url value='/css/cipe-ver2.css' />" rel="stylesheet" type="text/css" />

<script><!--
 function windowchangeMSG(){
 		    var content = $('#content:first').find('div:first').attr('id');
		     var msg = '';
		    if(content !=undefined){
		    // alert(content);		    
		     var msg1='open form. Unsaved data will be lost. Click on cancel to continue working on this form';
		     if(content=='editDonorDiv')msg='You have "Donor- Add" ' + msg1;
		     if(content=='editDonorawardDiv')msg='You have "Donor Award - Add" ' + msg1;
		     if(content=='editCipeprojectDiv')msg='You have "Project - Add" ' + msg1;
		     if(content=='editPartnergrantDiv')msg='You have "Partner Grant - Add" ' + msg1;
		     if(content=='editPaymentrequestDiv')msg='You have "Payment Request - Add" ' + msg1;
		     if(content=='editUserDiv')msg='You have "Manage Users" ' + msg1;
		     if(content=='editRoleDiv')msg='You have "Manage Roles" ' + msg1;
		     if(content=='editRegionDiv')msg='You have "Manage Regions" ' + msg1;
		     if(content=='editCountryDiv')msg='You have "Manage Countries" ' + msg1;
		     if(content=='editStateDiv')msg='You have "Manage States" ' + msg1;
		     if(content=='editFieldofficeDiv')msg='You have "Manage Donor Award Types " ' + msg1;
		     if(content=='editDonorawardstatusDiv')msg='You have "Manage Donor Award Statuses " ' + msg1;
		     if(content=='editCipeprojecttypeDiv')msg='You have "Manage Project Types " ' + msg1;
		     if(content=='editKeywordDiv')msg='You have "Manage Knowledge Management Keywords " ' + msg1;    
		     if(content=='changePasswordDiv')msg='You have "Change Password " ' + msg1;
		     }
		   return msg; 
 }
function updatecn(id){
	loadDiv('cnContent', 'changeNotification.do?id='+id);
}

function refreshDashboard(){
	if(document.getElementById('mark')){
		loadDiv('content', 'refreshDashboard.do');
	}
	else{
		location.reload(true);
	}	
}

function dashboardRefresh(){
	if(document.getElementById('mark')){
		loadDiv('content', 'refreshDashboard.do');
	window.setTimeout("dashboardRefresh()", 60000);
	}	
}
	
window.setTimeout("dashboardRefresh()", 60000);

$(document).ready(function() {
		/* Commented due to BLOG96  allen this is common for all search This is implemented for the Issue BLOG2*/
		   $(document).keypress(function(e) {
	    //alert("button value...."+$(this).val());    
        if(e.which == 13) {      
             jQuery(this).blur();
            jQuery('#loginFormSubmit').click();          
          }
    	 });
		
	$(window).bind("beforeunload",function(event) {
	    var msg = windowchangeMSG();	   
    	if(msg !=''){
    	 // alert(msg); 
    	   return msg;
    	}
	});
		
		
	   /* BLOG96 Pressing the Enter key - When the user presses the enter key
		while adding a record or editing a record, the system
		attempts to save the record...THIS SHOULD NOT OCCUR...
		causes errors.
		*/
	   /* Allen u can change the name of submit button. So enter key will not submit those forms.	
		$(':input').live('keypress', function(event) {
		    if(event.keyCode == 13) {
				if(event.preventDefault) {
		   			event.preventDefault();
		   		} else {
		   			// IE
		   			event.returnValue = false;
		   		}
		   		return false;
		    }
		});
	*/
		$('.links li a').click(function() {
		    //alert("link cliked..");
           var msg = windowchangeMSG();
		    if(msg!=''){
		     	var ans=window.confirm(msg);		     
		     	if(!ans)return;
		      }
		 
			loadDiv('content', $(this).attr('url'));
			$('.links li a').removeClass('active');
			$(this).addClass('active');
		});

		$('.dl').click(function() {
			loadDiv('content', $(this).attr('url'));
		});
	
		$('.cndl').click(function() {
			loadDiv('content', $(this).attr('url'));
		});
			
		$('.link-heading').click(function() {
			$(this).next().slideToggle('normal');
			$(this).find('span.ui-icon').toggleClass('ui-icon-triangle-1-s');
		});

		$('#changePasswordLink').click(function() {
			loadDiv('content', $(this).attr('url'));
		});
	});

	$('#pageRefresh').click(function() {

		location.reload();

	});
--></script>

</head>
<body>
<div id="header">
    <div class="logo">
    	<a href="../secure/showDashboard.do" id="logoLink" url='showDashboard.do'>
    	<img src="<c:url value='/images/cipelogo.gif'/>" width="90" height="75" alt="CIPE logo" /></a>
    </div>
	<h1 id="pageTitle"></h1>    
    <div class="name">
    <img src="<c:url value='/images/cipe-banner.png' />" /><br>
    <b><spring:message code="baner.title" /></b>
    </div>
    <br class="clear" />
</div>
<div class="cipe-sub-nav">
    <ul class="floatL">
        <li><a href="../secure/showDashboard.do" id="crmsHomeLink" class="active">CMRS Home</a></li>
        <li><a href="javascript:void(0);" id="changePasswordLink"  url='showChangePassword.do'>Change Password</a></li>
        <li><a href="../logout.do">Logout</a></li>
        <li class="cipe-username">Welcome, ${user.firstName}&nbsp;${user.lastName}</li>
   </ul>
   <ul class="floatR">     
		<li>
			<label>View Home Page By:</label>
			<select>
				<option>All Regions</option>
				<option>Africa</option>
				<option>Asia</option>
				<option>Central and Eastern Europe</option>
				<option>Middle East</option>
                <option>South Asia</option>
				<option>Eurasia</option>
				<option>Latin America</option>
				<option>Assigned to me</option>
           </select>
		</li>							
        <li class="padding_left20"><a href="javascript:refreshDashboard()">Refresh</a></li>
		<li><a href="javascript:window.print()">Print</a></li>
		<li><a href="javascript: history.go(-1)">Back</a></li>
		<li><a href="javascript: history.go(1)">Forward</a></li>
    </ul>
    <br class="clear" />
</div>
<div class="main_cont">
	<div id="left">
		<c:forEach items="${linkCategories}" var="linkCategory" varStatus="status">
			<div class="links-main">
				<c:set var="class" value="" />
				<c:set var="display" value="none" />
				<c:if test="${status.first }">
					<c:set var="class" value="ui-icon-triangle-1-s" />
					<c:set var="display" value="none" />
				</c:if>
				<div class="link-heading">
					<span class="ui-icon ui-icon-triangle-1-e" style="float: left;"></span>
					<span style="position: relative; top: 2px;">${linkCategory.name}</span>
				</div>
				<div class="links" style="display: ${display};">
					<ul>
						<c:forEach items="${linkCategory.links}" var="link">						
						 <c:if test="${link.url!='findPartnergrant.do'}">
							<li><a href="javascript://" url="${link.url}">${link.name}</a></li>
						 </c:if>	
						</c:forEach>
					
						
					</ul>
				</div>
			</div>
		</c:forEach>
	</div>
	<jsp:include page="dashboardDiv.jsp" />
</div>
</body>